<?php

use Illuminate\Support\Facades\Route;
use Vinlon\Laravel\LayAdmin\AdminResponse;

Route::middleware(['auth:lay-admin', AdminResponse::class])->group(function () {
    # 合作商
    Route::resource('partners', 'PartnerController')->only(['index', 'store', 'destroy']);
    Route::post('partners/{id}/status', 'PartnerController@changeStatus');

    # 代理商
    Route::resource('agents', 'AgentController')->only(['index', 'store', 'destroy']);
    Route::post('agents/{id}/status', 'AgentController@changeStatus');
    Route::get('agents/{id}/settings', 'AgentController@getAgentSettings');
    Route::post('agents/{id}/settings', 'AgentController@saveAgentSettings');

    # 商品分类
    Route::get('agents/{id}/categories', 'ProductController@getAgentCategories');

    # 商品管理
    Route::post('products/image', 'ProductController@uploadProductImage');
    Route::resource('products', 'ProductController')->only(['index', 'show']);
    Route::get('products/{id}/tokens', 'ProductController@listProductTokens');
    Route::post('products/{id}/release', 'ProductController@releaseProduct');
    Route::post('products/{id}/offline', 'ProductController@offlineProduct');

    // 订单
    Route::get('orders', 'OrderController@listOrders');
    Route::get('resale_orders', 'OrderController@listResaleOrders');
    Route::get('blind_box_orders', 'OrderController@listBlindBoxOrders');
    Route::get('orders/{id}', 'OrderController@getOrder');
    Route::post('orders/{id}/re_transfer', 'OrderController@reTransfer');

    //邀请活动
    Route::get('invites', 'InvitationActivityController@listInvites');
    Route::post('invites/create', 'InvitationActivityController@createInvites');
    Route::get('invites/{id}', 'InvitationActivityController@getInvitesDetail');
    Route::delete('invite/{id}', 'InvitationActivityController@deleteInvitesDetail');
    Route::get('invites_ranking', 'InvitationActivityController@getInvitesDetails');
    Route::post('invite/change_no', 'InvitationActivityController@changeInvitesStatusNo');
    Route::post('invite/change_yes', 'InvitationActivityController@changeInvitesStatusYes');
    Route::post('invite/activity_close', 'InvitationActivityController@changeActivityStatusClose');
    Route::post('invite/activity_open', 'InvitationActivityController@changeActivityStatusOpen');
    Route::get('invites/{activity_id}/registers_export', 'InvitationActivityController@exportRegisters');
    Route::post('invites/{activity_id}/registers/{register_id}/invited_users_export', 'InvitationActivityController@exportInvitedUsers');

    // 合成
    Route::get('convert_formulas', 'ConvertController@listFormulas');
    Route::get('convert_formulas/{id}', 'ConvertController@getFormula');
    Route::post('convert_formulas', 'ConvertController@saveFormula');
    Route::post('convert_formulas/{id}/status', 'ConvertController@changeStatus');
    Route::get('convert_formulas/{id}/records', 'ConvertController@listRecords');
    Route::get('convert_formulas/{id}/records_export', 'ConvertController@exportRecords');

    // 空投
    Route::get('airdrops', 'AirdropController@index');
    // 盲盒空投
    Route::get('airdrops/blind_box', 'AirdropBlindBoxController@index');

    Route::get('agent_amount', 'OrderController@getAgentOrderCharge');

    # 用户管理
    Route::get('users', 'UserController@index');
    Route::post('users/{id}/del_auth', 'UserController@deleteUserAuth');

    # 登记管理
    Route::get('registries', 'RegistryController@index');
    Route::get('registries/{id}', 'RegistryController@show');
    Route::get('registry/settle_summary', 'RegistryController@getSettleSummary');
    Route::get('registry/settle_months', 'RegistryController@getSettleMonths');
    Route::get('registry/settle_export', 'RegistryController@exportMonthSettleDetail');

    # 配置
    Route::get('settings', 'OpsController@getSettings');
    Route::post('settings', 'OpsController@saveSettings');

    Route::get('enterprises', 'EnterpriseController@index');
    Route::delete('enterprises/{id}', 'EnterpriseController@destroy');
    Route::post('enterprises/store', 'EnterpriseController@store');
    Route::get('enterprises/get_address', 'EnterpriseController@address');
    Route::get('enterprises/get_bank', 'EnterpriseController@banks');
    Route::get('enterprises/{id}', 'EnterpriseController@show');

    Route::get('get_channels', 'UserImportController@getChannels');
    Route::post('user_import', 'UserImportController@userimport');
    Route::post('excelimport', 'UserImportController@excelimport');

    Route::post('export/products', 'ProductController@export');
    Route::post('export/resale', 'ProductController@resaleExport');
    Route::post('export/blind', 'ProductController@blindExport');
    Route::post('fontendusers/export', 'UserController@export');

    Route::post('order/export', 'OrderController@export');

    Route::post('resale/export', 'OrderController@resaleExport');
    Route::post('blind/export', 'OrderController@blindExport');

    Route::get('downloads', 'DownloadController@index');
});
